<style>
    .layui-form-item{
        margin: 0;
    }
    .layui-inline {
        margin-top: 15px;
    }
    .layui-form-label{
        float: left;
        display: block;
        padding: 9px 15px;
        width: 70px;
        font-weight: 400;
        line-height: 20px;
        text-align: left;
    }
</style>
<form class="layui-form layui-form-pamel" name="form1" id="form1" method="post">
    <div class="searchbox demoTable" id="searchbox">
        <div class="layui-form-item">

            <div class="layui-inline">
                <label class="layui-form-label">手机号：</label>
                <div class="layui-input-inline">
                    <input class="layui-input" type="text" maxlength="50" name="phone" id="phone"
                           placeholder="请输入手机号"/>
                </div>
            </div>
            <input type="button" value="查询" onclick="$.table.search()" class="layui-btn layui-btn-red"/>
        </div>
    </div>
</form>

<div style="overflow:auto;width: 100%;padding-bottom: 20px;">
    <table id="simple-table" class="layui-table" lay-filter="simple-table">
    </table>
    <script type="text/html" id="barTable">
        <a class="layui-icon layui-icon-auz colored7764" lay-event="limitUser" title="授权"></a>
        <a class="layui-icon layui-icon-edit colored7764" lay-event="editFlag" title="修改"></a>
        <a class="layui-icon layui-icon-delete colored7764" lay-event="delFlag" title="删除"></a>
    </script>

    <script type="text/html" id="toolbarTable">
        <div class="layui-inline" title="添加" lay-event="addFlag"><i class="layui-icon layui-icon-add-circle"></i></div>
        <div class="layui-inline" title="导出" lay-event="exportExcel"><i class="layui-icon layui-icon-export"></i></div>
    </script>
</div>


<script type="text/javascript">

    var prefix = basePath + "system/user";

    var options = {
        id: 'simple-table',
        url: prefix + '/sysUserlistPage',
        javaField: 'userId',    //主键
        addUrl: prefix + '/addSysUser',   //添加
        deleteUrl: prefix + '/deleteSysUser',    //删除
        editUrl: prefix + '/toEditSysUser?userId=',   //编辑
        exportUrl: prefix + '/exportSysUser',    //导出
        importTemplate: prefix + '/impTempSysUser',   //下载导入模板
        importTemplateUrl: prefix + '/impTempSysUserUrl',    //导入

        width: 500,  //开启头部工具栏右侧
        height: 400,  //开启头部工具栏右侧
        addFull: false, //弹出框最大化
        editFull: false, //弹出框最大化
        toolbar: '#toolbarTable',  //开启工具栏
        modalName: '用户',
        cols: [[
            {type: 'numbers', title: '序号', width: 50}
            , {field: 'userId', title: 'EHR号'}
            , {field: 'userName', title: '用户名'}
            , {field: 'phone', title: '手机号'}
            , {field: 'lastLoginTime', title: '最后登录时间'}
            , {title: '操作', width: 178, align: 'center', toolbar: '#barTable'}
        ]],
        page: true
    };

    var init = $.table.init(options);


    function limitUser(data) {
        layer.open({
            type : 2,//此处以iframe举例
            title : '用户权限设置',
            area : [ '500px', '400px' ],
            content : '${basePath}system/user/toUserLimit?userId='+data.userId,
            btn : [ '保存', '关闭' ], //只是为了演示
            yes : function(index, layero) {
                var iframeWin = window[layero.find('iframe')[0]['name']];
                iframeWin.save();
            },
            no : function(index) {
                layer.close(index);
            },
            end : function() {
            }
        });
    }
</script>
